<%@ page contentType="text/html;charset=UTF-8" %>
<%@ include file="/include.inc.jsp" %>
<!DOCTYPE html>

<html>
<head>
    <%@include file="/WEB-INF/views/layout/miiteen/base.ref.jsp" %>
</head>
<body>
<div class="mainpage edit">
    <!--顶部菜单-->
    <div class="page-topmenu">
        <div class="btn-panel">
            <el-button type="primary" size="small" icon="el-icon-check" @click="save">保存</el-button>
        </div>
        <div class="btn-panel">
            <el-button size="small" icon="el-icon-back" @click="back">返回</el-button>
        </div>
    </div>
    <!--编辑表单-->
    <el-form :ref="formid" :model="form" :rules="rules" size="small" :label-width="labelwidth"
             :label-position="labelposition"
             class="one-col" :validate-on-rule-change="false">

        <!--视业务进行更改-begin-->
        <input type="hidden" v-model="form.id"/>
        <el-form-item label="账号" prop="account">
            <el-input v-model="form.account" placeholder="账号" :disabled="form.id>0?true:false"></el-input>
        </el-form-item>
        <el-form-item label="密码" prop="pwd" v-if="form.id<1">
            <el-input type="password" v-model="form.pwd" placeholder="密码"></el-input>
        </el-form-item>
        <el-form-item label="角色" prop="roleNames">
            <el-input v-model="form.roleNames" placeholder="角色" @focus="selectRole"></el-input>
        </el-form-item>
        <el-form-item label="工号" prop="jobNo">
            <el-input v-model="form.jobNo" placeholder="工号"></el-input>
        </el-form-item>
        <el-form-item label="姓名" prop="trueName">
            <el-input v-model="form.trueName" placeholder="姓名"></el-input>
        </el-form-item>
        <el-form-item label="性别">
            <el-radio-group v-model="form.sex">
                <el-radio :label="1">男</el-radio>
                <el-radio :label="2">女</el-radio>
            </el-radio-group>
        </el-form-item>
        <el-form-item label="部门">
            <el-input v-model="form.deptName" placeholder="部门" @focus="selectDept"></el-input>
        </el-form-item>
        <el-form-item label="邮箱">
            <el-input v-model="form.email" placeholder="邮箱"></el-input>
        </el-form-item>
        <el-form-item label="手机">
            <el-input v-model="form.phone" placeholder="手机"></el-input>
        </el-form-item>
        <!--视业务进行更改-end-->

    </el-form>
</div>
<script>
    //初始化数据，必须放置在列表页面封装部分前
    function initVueOption(obj) {
        //设置控制器
        obj.data.controller = "${ctx}/user/useruserinfo";
        //设置表单数据
        obj.data.form = ${userUserInfo};
        //设置校验规则，没有则删掉
        obj.data.rules = {
            account: [
                {required: true, message: '请输入账号', trigger: 'blur'}
            ],
            pwd: [
                {required: true, message: '请输入密码', trigger: 'blur'}
            ],
            roleNames: [
                {required: true, message: '请选择角色', trigger: 'blur'}
            ],
            jobNo: [
                {required: true, message: '请输入工号', trigger: 'blur'}
            ],
            trueName: [
                {required: true, message: '请输入姓名', trigger: 'blur'}
            ]
        }

        //选择角色
        obj.methods.selectRole = function () {
            var param = {
                title: "",
                type: "list",
                multiple: false
            };
            if ("${roleIds}") {
                param.ids = "${roleIds}";
            }
            miiteen.customsearch.open("sysRole", function (result) {
                var role = result[0];
                Page.form.roleIds = role.result1;
                Page.form.roleNames = role.result2;
            }, param)
        }

        //选择部门
        obj.methods.selectDept = function () {
            miiteen.customsearch.open("sysDepartment", function (result) {
                Page.form.deptId = result[0].result1;
                Page.form.deptName = result[0].result2;

            }, {
                title: "部门选择",
                type: "tree",
                multiple: false,
                con: {deptIds: "${deptIds}"}
            })
        }
    }
</script>
<!--编辑页面封装部分-->
<%@include file="/WEB-INF/views/layout/miiteen/page.edit.ref.jsp" %>
</body>
</html>
